package com.jiyun.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //文件上传路径
        String path = "D:/0000/";
        //访问的时候，http://localhost:82/images/16327360-765e-43ac-b008-d036f3caa43a.jpg
        registry.addResourceHandler("/images/**").addResourceLocations("file:"+path+"/");
    }
}